package elitech.vietnam.myfashion;

import android.app.Application;
import android.content.IntentFilter;
import elitech.vietnam.myfashion.badge.BadgeHelper;
import elitech.vietnam.myfashion.gcm.GCMBroadcastReceiver;

public class MyApplication extends Application {

	private GCMBroadcastReceiver mReceiver;
	public BadgeHelper mBadge;
	
	@Override
	public void onCreate() {
		super.onCreate();
		mBadge = new BadgeHelper(this);
	}
	
	public void startGCMNotification() {
		if (mReceiver == null) {
			mReceiver = new GCMBroadcastReceiver();
			IntentFilter filter = new IntentFilter("com.google.android.c2dm.intent.RECEIVE");
			filter.addCategory("elitech.vietnam.myfashion");
			registerReceiver(mReceiver, filter, "com.google.android.c2dm.permission.SEND", null);
		}
	}
	
	public void stopGCMNotification() {
		if (mReceiver != null) {
			unregisterReceiver(mReceiver);
			mReceiver = null;
		}
	}

}
